Skip to main content

All Questions

5votes
2answers
596views

Leet Code 139 (Word Break) using a trie with recursion

I was attempting to solve LeetCode 139 - Word Break Given a string s and a dictionary of strings wordDict, return ...
Shawn Frank's user avatar
1vote
1answer
216views

Minimum Window Substring in Swift exceeds LeetCode runtime check

This is a popular question on LeetCode: 76. Minimum Window Substring Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in ...
Shawn Frank's user avatar
2votes
1answer
3kviews

Dynamic Array Problem (Hacker rank)

I am trying to solve the Dynamic Array problem on HackerRank: Create a list, seqList, of N empty sequences, where each sequence is indexed from 0 to N-1. The elements within each of the N ...
Siddharth Kumar's user avatar
3votes
1answer
528views

Minimum window substring - LeetCode challenge

Below is my code for the “Minimum Window Substring” LeetCode problem in Swift: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(...
Vaibhav Singh's user avatar
4votes
1answer
846views

Checking whether strings are permutations of each other in Swift

I'm solving this problem on Hacker Earth, just for practice. The exercise is to determine whether two given equal-length strings are permutations of each other. Except for this one test case, which ...
kanadenipun's user avatar
3votes
1answer
164views

Project Euler problem #14 (longest Collatz chain) in Swift

This is my Swift code for finding the starting number, under one million, which produces the longest collatz chain. ...
mobs_boss's user avatar
8votes
4answers
1kviews

Project Euler problem 14 (longest Collatz sequence) in Swift 3

I was trying to solve Project Euler:Problem 14 using Swift 3, but it takes ages to give me an answer, which is a sign that my code is absolute garbage performance-wise. What could I do to increase the ...
user avatar
2votes
2answers
3kviews

Swift HackerRank Missing Numbers Challenge

I'm attempting to solve the "Missing Numbers" challenge on HackerRank where I'm tasked with finding missing elements comparing two arrays. Foundation's ...
Adrian's user avatar
4votes
2answers
4kviews

Swift solution to Leetcode “Longest Substring Without Repeating Characters”

From LeetCode medium 3. Longest Substring Without Repeating Characters: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", ...
Zekun Tang's user avatar
5votes
1answer
271views

Project Euler, Challenge #12 in Swift

The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, ...
codez's user avatar

close